package chinac

import "time"

type CloudPhone struct {
	Region string `json:"Region"`
	Id     string `json:"Id"`
}

type Response struct {
	Code    interface{}            `json:"code,ResponseCode"`
	Message string                 `json:"message,ResponseMsg"`
	Data    map[string]interface{} `json:"data,ResponseData"`
	Date    time.Time              `json:"ResponseDate"`
	TaskId  string                 `json:"ResponseTaskId"`
}

func (r Response) Success() bool {
	return r.Code.(float64) == 10000
}

func (r Response) String() string {
	marshal, _ := Json.MarshalIndent(r, "", "  ")
	return string(marshal)
}

type CmdResponse struct {
	ResponseCode   interface{}            `json:"ResponseCode"`
	ResponseMsg    string                 `json:"ResponseMsg"`
	ResponseData   map[string]interface{} `json:"ResponseData"`
	ResponseDate   time.Time              `json:"ResponseDate"`
	ResponseTaskId string                 `json:"ResponseTaskId"`
}

func (r CmdResponse) Success() bool {
	return r.ResponseCode.(float64) == 100000
}

func (r CmdResponse) String() string {
	marshal, _ := Json.MarshalIndent(r, "", "  ")
	return string(marshal)
}
